﻿using System;
using System.Collections.Generic;
using SobrietyEngine.UDMF;
using SobrietyEngine.Actor;
using SobrietyEngine.Components;
using SobrietyEngine.Components.UDMF;
using SobrietyEngine.Scene;
using Microsoft.Xna.Framework;

namespace SobrietyEngine.Actor.Builders.UDMF
{
    public class UDMFMapBldr:BaseActorBuilder
    {
        public static IActor Build(IScene scene, String udmfAsset, Vector3 pos, Vector3 rot, Vector3 scale)
        {
            IActor udmfMapActor = scene.CreateEmptyActor();
            udmfMapActor.AttachComponent(new UDMFMapCmp(udmfAsset));
            udmfMapActor.AttachComponent(new SobrietyEngine.Components.Common.ScaleCmp(scale));
            udmfMapActor.AttachComponent(new SobrietyEngine.Components.Common.PositionCmp(pos));
            udmfMapActor.AttachComponent(new SobrietyEngine.Components.Common.OrientationCmp(rot));
            //the map actor will behave as a root node for its walls and such
            udmfMapActor.AttachComponent(new SobrietyEngine.Components.SceneGraph.SceneNodeCmp());
            udmfMapActor.Initialize();
            return udmfMapActor;
        }
    }
}
